<template>
	<div>
		<!--系统热更新-->
		<wrap-version-update id="469921773617221"></wrap-version-update>
		<view style="background: url('../../static/mine/top_bg.png') no-repeat;height: 300px;background-size: cover;">
		</view>
		<view style="position: relative;top: -225px;">
			<view style="margin: 10px;border-radius: 12px;padding: 10px;display: flex;">
				<!-- <image @click="toUserCenter" style="width: 100px; height: 100px; background-color: #eeeeee;border-radius: 50%;" mode="center" :src="user?user.vuex_avatar:'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png'"></image> -->
			    <image @click="toUserCenter" style="width: 100px; height: 100px; background-color: #eeeeee;border-radius: 50%;" mode="center" src="../../static/personal.png"></image>
				<view style="display: flex;flex-direction: column;justify-content: space-around;margin-left: 10px;">
					<span>
						<text>{{user.vuex_userInfo.dept.deptName}}</text>
						<text v-if="user.vuex_userInfo.dept.status==='0'" style="color: #ff5500;margin-left: 5px;">已认证</text>
						<text v-else style="color: #ff5500;margin-left: 5px;">未认证</text>
					</span>
					<span>
						<text>企业ID：</text>
						<text>{{user.vuex_userInfo.deptId}}</text>
						<text>【完整版】</text>
					</span>
					<span>
						<text>账号：</text>
						<text>{{user.vuex_userInfo.phonenumber}}</text>
						<!-- <text>【调度】</text> -->
					</span>
				</view>
			</view>
			<view style="background-color: #ffffff;margin: 10px;border-radius: 12px;padding: 10px;">
				<uni-grid :column="2" :show-border="false" :square="false" @change="change">
					<uni-grid-item v-for="(item ,index) in list" :index="index" :key="index">
						<view class="grid-item-box">
							<!-- <image class="image" :src="item.url" mode="aspectFill" /> -->
							<uni-icons :type="item.ico" size="25"></uni-icons>
							<text class="text">{{item.text}}</text>
							<view v-if="item.badge" class="grid-dot">
								<uni-badge :text="item.badge"  type="error" />
							</view>
						</view>
					</uni-grid-item>
				</uni-grid>
			</view>
		</view>
		<view @click="exitLogin" hover-class="buttonHover" style="position: fixed;left: 50%;transform:translateX(-50%);bottom:70px;width: 100px;height:33px;display:flex;justify-content: center;align-items: center;background-color: #bf5f09;color: #ffffff;border-radius: 4px;">
			退出
		</view>
		<view class="position"  style="position: fixed;left: 50%;transform:translateX(-50%);bottom:10px;width: 120px;height:30px;display:flex;justify-content: center;align-items: center;">
			运油宝V{{appVersion}}
		</view>
		<!-- <view style="position: fixed;left: 50%;transform:translateX(-50%);bottom:60px;font-size: 14px;">
			链物流V{{appVersion}}
		</view> -->
		
		<!--引导页-->
		<!-- <guide :index="1"></guide> -->
	</div>
</template>

<script>
	import guide from '@/components/guide/guide.vue'
	export default {
		components: {
			guide
		},
		data() {
			return {
				user:uni.getStorageSync('storage_data')||[],
				 list: [
				//	 {
				// 		url: '/static/logo.png',
				// 		ico:'wallet',
				// 		text: '电子钱包',
				// 		link:'/pages/mine/accountCenter'
				// 	},
					// {
					// 	url: '/static/logo.png',
					// 	ico:'compose',
					// 	text: '运单收付',
					// 	link:'/pages/mine/waybillReceipt'
					// },
					{
						url: '/static/logo.png',
						ico:'calendar',
						text: '统计',
						link:'/pages/mine/statistics/statistics'
					},
					// {
					// 	url: '/static/logo.png',
					// 	ico:'notification',
					// 	text: '消息中心',
					// 	badge: '13',
					// 	link:'/pages/mine/informationCenter'
					// },
					{
						url: '/static/logo.png',
						ico:'chat',
						text: '日志',
						link:'/pages/mine/log'
					},
					// {
					// 	url: '/static/logo.png',
					// 	ico:'headphones',
					// 	text: '服务&声明',
					// 	link:'/pages/mine/serviceAndStatement'
					// }
				],
				appVersion:'2.0.5',
			}
		},
		created() {
			//#ifdef APP-PLUS
			// 获取本地应用资源版本号
			plus.runtime.getProperty(plus.runtime.appid, (info) => {
			    console.log(JSON.stringify(info));
				this.appVersion=info.version
			    // this.version = info.version;
			    // this.versionCode = info.versionCode ;
			})
			//#endif
		},
		methods: {
			//跳转用户中心
			toUserCenter(){
				uni.navigateTo({
					url:'/pages/mine/userCenter'
				})
			},
			change(e) {
				let {index} = e.detail
				uni.navigateTo({
					url:this.list[index].link
				})
			},
			//退出登录
			exitLogin(){
				let that=this
				uni.showModal({
					title: '提示',
					content: '确定退出登录吗？',
					success: function(res) {
						if (res.confirm) {
							uni.showLoading({
								title:'正在退出...'
							})
							// uni.removeStorageSync('App-Token');//清除缓存
							// uni.removeStorageSync('storage_data');
							
							setTimeout(()=>{
								uni.hideLoading() 
								that.$store.dispatch('LogOut').then(res => {
								  uni.reLaunch({ url: '/pages/login/login' })
								})
							},800)
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},
		},
	}
</script>

<style scoped>
	.image {
		width: 25px;
		height: 25px;
	}

	.text {
		font-size: 14px;
		margin-top: 5px;
	}

	.grid-item-box {
		flex: 1;
		// position: relative;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
	}
	.grid-dot {
			position: absolute;
			top: 5px;
			right: 15px;
		}
		
	.buttonHover{
		opacity: 0.6;
	}
</style>